<?php
/**
 * Created by PhpStorm.
 * User: sunjian
 * Date: 2018/3/7
 * Time: 19:05
 */

namespace backend\controllers;

use app\models\Order;
use yii\web\Controller;
use Yii;
use yii\data\Pagination;

class OrderController extends Controller
{
    public function actionList(){

        $query = Order::find()->where(['flag' => 0])->orderBy("create_time");
        $countQuery = clone $query;
        $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => '20']);
        $orders = $query->offset($pages->offset)
            ->limit($pages->limit)->asArray()
            ->all();


        return $this->render("list",['orders'=>$orders,'p'=>$pages]);
    }

    public function actionView(){
        $request = Yii::$app->request;
        $id = $request->get("id");
        
    }
}